In [1]:
# imports
from src.config import *
from src.mlflow_logging import train_and_log_model
In [2]:
import mlflow

experiments = mlflow.tracking.MlflowClient().list_experiments()

for experiment in experiments:
    print(f"Experiment ID: {experiment.experiment_id}, Name: {experiment.name}")
Experiment ID: 0, Name: Default
Experiment ID: 1, Name: DecisionTreeClassifier_1
Experiment ID: 10, Name: ExtraTreeClassifier_4
Experiment ID: 11, Name: ExtraTreeClassifier_5
Experiment ID: 12, Name: ExtraTreeClassifier_6
Experiment ID: 13, Name: RandomForestClassifier_1
Experiment ID: 14, Name: RandomForestClassifier_2
Experiment ID: 15, Name: RandomForestClassifier_3
Experiment ID: 16, Name: RandomForestClassifier_4
Experiment ID: 17, Name: RandomForestClassifier_5
Experiment ID: 18, Name: RandomForestClassifier_6
Experiment ID: 19, Name: ExtraTreesClassifier_1
Experiment ID: 2, Name: DecisionTreeClassifier_2
Experiment ID: 20, Name: ExtraTreesClassifier_2
Experiment ID: 21, Name: ExtraTreesClassifier_3
Experiment ID: 22, Name: ExtraTreesClassifier_4
Experiment ID: 23, Name: ExtraTreesClassifier_5
Experiment ID: 24, Name: ExtraTreesClassifier_6
Experiment ID: 25, Name: AdaBoostClassifier_1
Experiment ID: 26, Name: AdaBoostClassifier_2
Experiment ID: 27, Name: AdaBoostClassifier_3
Experiment ID: 28, Name: AdaBoostClassifier_4
Experiment ID: 29, Name: AdaBoostClassifier_5
Experiment ID: 3, Name: DecisionTreeClassifier_3
Experiment ID: 30, Name: AdaBoostClassifier_6
Experiment ID: 31, Name: GradientBoostingClassifier_1
Experiment ID: 32, Name: GradientBoostingClassifier_2
Experiment ID: 33, Name: GradientBoostingClassifier_3
Experiment ID: 34, Name: GradientBoostingClassifier_4
Experiment ID: 35, Name: GradientBoostingClassifier_5
Experiment ID: 36, Name: GradientBoostingClassifier_6
Experiment ID: 37, Name: XGBClassifier_1
Experiment ID: 38, Name: XGBClassifier_2
Experiment ID: 39, Name: XGBClassifier_3
Experiment ID: 4, Name: DecisionTreeClassifier_4
Experiment ID: 40, Name: XGBClassifier_4
Experiment ID: 41, Name: XGBClassifier_5
Experiment ID: 42, Name: XGBClassifier_6
Experiment ID: 43, Name: CatBoostClassifier_1
Experiment ID: 44, Name: CatBoostClassifier_2
Experiment ID: 45, Name: CatBoostClassifier_3
Experiment ID: 46, Name: CatBoostClassifier_4
Experiment ID: 47, Name: CatBoostClassifier_5
Experiment ID: 48, Name: CatBoostClassifier_6
Experiment ID: 5, Name: DecisionTreeClassifier_5
Experiment ID: 6, Name: DecisionTreeClassifier_6
Experiment ID: 7, Name: ExtraTreeClassifier_1
Experiment ID: 8, Name: ExtraTreeClassifier_2
Experiment ID: 9, Name: ExtraTreeClassifier_3

Other algorithms¶

  • Linear_model: LogisticRegression
  • Naive_bayes: GaussianNB, BernoulliNB
  • Neighbors: KNeighborsClassifier
  • GaussianProcessClassifier
  • MLPClassifier
  • SVC

1. Linear_model: LogisticRegression¶

1.1 Using feature set 1¶

In [3]:
# Parameter ranges
param_ranges = {
    "penalty": ["l2"],  # ["l1", "l2", "elasticnet"] certain combinations have conflict
    "C": np.logspace(-4, 4, 4),                    
    "solver": ["liblinear", "saga", "lbfgs", "newton-cg", "sag"],   
    "max_iter": [100, 200, 500],                      
    "random_state": [42]                            
}


# Train and log the model
train_and_log_model(model_class=LogisticRegression, param_ranges=param_ranges, feature_set='1', cv_folds=5)
2024/09/25 08:22:17 INFO mlflow.tracking.fluent: Experiment with name 'LogisticRegression_1' does not exist. Creating a new experiment.
Hyperparameter combinations:   0%|                                                              | 0/60 [00:00<?, ?it/s]2024/09/25 08:22:17 WARNING mlflow.tracking.context.git_context: Failed to import Git (the Git executable is probably not on your PATH), so Git SHA is not available. Error: Failed to initialize: Bad git executable.
The git executable must be specified in one of the following ways:
    - be included in your $PATH
    - be set via $GIT_PYTHON_GIT_EXECUTABLE
    - explicitly set via git.refresh(<full-path-to-git-executable>)

All git commands will error until this is rectified.

This initial message can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
    - quiet|q|silence|s|silent|none|n|0: for no message or exception
    - warn|w|warning|log|l|1: for a warning message (logging level CRITICAL, displayed by default)
    - error|e|exception|raise|r|2: for a raised exception

Example:
    export GIT_PYTHON_REFRESH=quiet

Hyperparameter combinations: 100%|█████████████████████████████████████████████████| 60/60 [11:30:20<00:00, 690.33s/it]

image.png

1.2 Using feature set 2¶

In [4]:
# Parameter ranges
param_ranges = {
    "penalty": ["l2"],  # ["l1", "l2", "elasticnet"]
    "C": np.logspace(-4, 4, 4),                    
    "solver": ["liblinear", "saga", "lbfgs", "newton-cg", "sag"],   
    "max_iter": [100, 200, 500],                      
    "random_state": [42]                            
}


# Train and log the model
train_and_log_model(model_class=LogisticRegression, param_ranges=param_ranges, feature_set='2', cv_folds=5)
2024/09/25 19:54:18 INFO mlflow.tracking.fluent: Experiment with name 'LogisticRegression_2' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|███████████████████████████████████████████████████| 60/60 [1:11:46<00:00, 71.78s/it]

image.png

1.3 Using feature set 3¶

In [5]:
# Parameter ranges
param_ranges = {
    "penalty": ["l2"],  # ["l1", "l2", "elasticnet"]
    "C": np.logspace(-4, 4, 4),                    
    "solver": ["liblinear", "saga", "lbfgs", "newton-cg", "sag"],   
    "max_iter": [100, 200, 500],                      
    "random_state": [42]                            
}


# Train and log the model
train_and_log_model(model_class=LogisticRegression, param_ranges=param_ranges, feature_set='3', cv_folds=5)
2024/09/25 21:07:43 INFO mlflow.tracking.fluent: Experiment with name 'LogisticRegression_3' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 60/60 [01:06<00:00,  1.11s/it]

image.png

1.4 Using feature set 4¶

In [6]:
# Parameter ranges
param_ranges = {
    "penalty": ["l2"],  # ["l1", "l2", "elasticnet"]
    "C": np.logspace(-4, 4, 4),                    
    "solver": ["liblinear", "saga", "lbfgs", "newton-cg", "sag"],   
    "max_iter": [100, 200, 500],                      
    "random_state": [42]                            
}


# Train and log the model
train_and_log_model(model_class=LogisticRegression, param_ranges=param_ranges, feature_set='4', cv_folds=5)
2024/09/25 21:10:33 INFO mlflow.tracking.fluent: Experiment with name 'LogisticRegression_4' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 60/60 [08:13<00:00,  8.22s/it]

image.png

1.5 Using feature set 5¶

In [7]:
# Parameter ranges
param_ranges = {
    "penalty": ["l2"],  # ["l1", "l2", "elasticnet"]
    "C": np.logspace(-4, 4, 4),                    
    "solver": ["liblinear", "saga", "lbfgs", "newton-cg", "sag"],   
    "max_iter": [100, 200, 500],                      
    "random_state": [42]                            
}


# Train and log the model
train_and_log_model(model_class=LogisticRegression, param_ranges=param_ranges, feature_set='5', cv_folds=5)
2024/09/25 21:20:26 INFO mlflow.tracking.fluent: Experiment with name 'LogisticRegression_5' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 60/60 [07:31<00:00,  7.52s/it]

image.png

1.6 Using feature set 6¶

In [8]:
# Parameter ranges
param_ranges = {
    "penalty": ["l2"],  # ["l1", "l2", "elasticnet"]
    "C": np.logspace(-4, 4, 4),                    
    "solver": ["liblinear", "saga", "lbfgs", "newton-cg", "sag"],   
    "max_iter": [100, 200, 500],                      
    "random_state": [42]                            
}


# Train and log the model
train_and_log_model(model_class=LogisticRegression, param_ranges=param_ranges, feature_set='6', cv_folds=5)
2024/09/25 21:29:30 INFO mlflow.tracking.fluent: Experiment with name 'LogisticRegression_6' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 60/60 [06:56<00:00,  6.95s/it]

image.png

2. Naive_bayes: GaussianNB, BernoulliNB¶

BernoulliNB: Naive Bayes classifier for multivariate Bernoulli models.

2.1 Using feature set 1¶

In [9]:
# GaussianNB

# Parameter ranges
param_ranges = {
    "var_smoothing": np.logspace(-9, -1, 30), 
}


# Train and log the model
train_and_log_model(model_class=GaussianNB, param_ranges=param_ranges, feature_set='1', cv_folds=5)
2024/09/25 23:15:39 INFO mlflow.tracking.fluent: Experiment with name 'GaussianNB_1' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 30/30 [11:00<00:00, 22.02s/it]

image.png

In [10]:
# BernoulliNB

# Parameter ranges
param_ranges = {
    "alpha": np.logspace(-3, 1, 5),         
    "binarize": [0.0, 0.5, 1.0],            
    "fit_prior": [True, False],             
}



# Train and log the model
train_and_log_model(model_class=BernoulliNB, param_ranges=param_ranges, feature_set='1', cv_folds=5)
2024/09/25 23:32:04 INFO mlflow.tracking.fluent: Experiment with name 'BernoulliNB_1' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 30/30 [08:20<00:00, 16.70s/it]

image.png

2.2 Using feature set 2¶

In [11]:
# GaussianNB

# Parameter ranges
param_ranges = {
    "var_smoothing": np.logspace(-9, -1, 30),  
}


# Train and log the model
train_and_log_model(model_class=GaussianNB, param_ranges=param_ranges, feature_set='2', cv_folds=5)
2024/09/25 23:41:55 INFO mlflow.tracking.fluent: Experiment with name 'GaussianNB_2' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 30/30 [01:44<00:00,  3.47s/it]

image.png

In [12]:
# BernoulliNB

# Parameter ranges
param_ranges = {
    "alpha": np.logspace(-3, 1, 5),         
    "binarize": [0.0, 0.5, 1.0],            
    "fit_prior": [True, False],             
}


# Train and log the model
train_and_log_model(model_class=BernoulliNB, param_ranges=param_ranges, feature_set='2', cv_folds=5)
2024/09/25 23:45:14 INFO mlflow.tracking.fluent: Experiment with name 'BernoulliNB_2' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 30/30 [01:25<00:00,  2.84s/it]

image.png

2.3 Using feature set 3¶

In [13]:
# GaussianNB

# Parameter ranges
param_ranges = {
    "var_smoothing": np.logspace(-9, -1, 30),  
}

# Train and log the model
train_and_log_model(model_class=GaussianNB, param_ranges=param_ranges, feature_set='3', cv_folds=5)
2024/09/25 23:48:18 INFO mlflow.tracking.fluent: Experiment with name 'GaussianNB_3' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 30/30 [00:25<00:00,  1.17it/s]

image.png

In [14]:
# BernoulliNB

# Parameter ranges
param_ranges = {
    "alpha": np.logspace(-3, 1, 5),         
    "binarize": [0.0, 0.5, 1.0],            
    "fit_prior": [True, False],             
}

# Train and log the model
train_and_log_model(model_class=BernoulliNB, param_ranges=param_ranges, feature_set='3', cv_folds=5)
2024/09/25 23:50:25 INFO mlflow.tracking.fluent: Experiment with name 'BernoulliNB_3' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 30/30 [00:27<00:00,  1.10it/s]

image.png

2.4 Using feature set 4¶

In [15]:
# GaussianNB

# Parameter ranges
param_ranges = {
    "var_smoothing": np.logspace(-9, -1, 30),  
}

# Train and log the model
train_and_log_model(model_class=GaussianNB, param_ranges=param_ranges, feature_set='4', cv_folds=5)
2024/09/26 08:33:02 INFO mlflow.tracking.fluent: Experiment with name 'GaussianNB_4' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 30/30 [00:32<00:00,  1.10s/it]

image.png

In [16]:
# BernoulliNB

# Parameter ranges
param_ranges = {
    "alpha": np.logspace(-3, 1, 5),         
    "binarize": [0.0, 0.5, 1.0],            
    "fit_prior": [True, False],             
}

# Train and log the model
train_and_log_model(model_class=BernoulliNB, param_ranges=param_ranges, feature_set='4', cv_folds=5)
2024/09/26 08:35:13 INFO mlflow.tracking.fluent: Experiment with name 'BernoulliNB_4' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 30/30 [00:33<00:00,  1.13s/it]

image.png

2.5 Using feature set 5¶

In [17]:
# GaussianNB

# Parameter ranges
param_ranges = {
    "var_smoothing": np.logspace(-9, -1, 30),  
}

# Train and log the model
train_and_log_model(model_class=GaussianNB, param_ranges=param_ranges, feature_set='5', cv_folds=5)
2024/09/26 08:37:24 INFO mlflow.tracking.fluent: Experiment with name 'GaussianNB_5' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 30/30 [00:32<00:00,  1.08s/it]

image.png

In [18]:
# BernoulliNB

# Parameter ranges
param_ranges = {
    "alpha": np.logspace(-3, 1, 5),         
    "binarize": [0.0, 0.5, 1.0],            
    "fit_prior": [True, False],             
}

# Train and log the model
train_and_log_model(model_class=BernoulliNB, param_ranges=param_ranges, feature_set='5', cv_folds=5)
2024/09/26 08:39:35 INFO mlflow.tracking.fluent: Experiment with name 'BernoulliNB_5' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 30/30 [00:36<00:00,  1.22s/it]

image.png

2.6 Using feature set 6¶

In [19]:
# GaussianNB

# Parameter ranges
param_ranges = {
    "var_smoothing": np.logspace(-9, -1, 30),  
}

# Train and log the model
train_and_log_model(model_class=GaussianNB, param_ranges=param_ranges, feature_set='6', cv_folds=5)
2024/09/26 08:41:48 INFO mlflow.tracking.fluent: Experiment with name 'GaussianNB_6' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 30/30 [00:34<00:00,  1.15s/it]

image.png

In [20]:
# BernoulliNB

# Parameter ranges
param_ranges = {
    "alpha": np.logspace(-3, 1, 5),         
    "binarize": [0.0, 0.5, 1.0],            
    "fit_prior": [True, False],             
}

# Train and log the model
train_and_log_model(model_class=BernoulliNB, param_ranges=param_ranges, feature_set='6', cv_folds=5)
2024/09/26 08:43:59 INFO mlflow.tracking.fluent: Experiment with name 'BernoulliNB_6' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 30/30 [00:31<00:00,  1.06s/it]

image.png

3. Neighbors: KNeighborsClassifier¶

3.1 Using feature set 1¶

In [21]:
# KNeighborsClassifier

# Parameter ranges
param_ranges = {
    "n_neighbors": np.arange(4, 21, 2),            
    "weights": ["uniform", "distance"],            
    "algorithm": ["auto", "ball_tree", "kd_tree", "brute"],  
    "leaf_size": np.arange(20, 51, 10),            
    "p": [1, 2]                                    
}

# Train and log the model
train_and_log_model(model_class=KNeighborsClassifier, param_ranges=param_ranges, feature_set='1', cv_folds=5)
2024/09/26 08:46:07 INFO mlflow.tracking.fluent: Experiment with name 'KNeighborsClassifier_1' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████| 576/576 [7:43:54<00:00, 48.32s/it]

image.png

3.2 Using feature set 2¶

In [22]:
# KNeighborsClassifier

# Parameter ranges
param_ranges = {
    "n_neighbors": np.arange(4, 21, 2),            
    "weights": ["uniform", "distance"],            
    "algorithm": ["auto", "ball_tree", "kd_tree", "brute"],  
    "leaf_size": np.arange(20, 51, 10),            
    "p": [1, 2]                                    
}

# Train and log the model
train_and_log_model(model_class=KNeighborsClassifier, param_ranges=param_ranges, feature_set='2', cv_folds=5)
2024/09/26 16:31:40 INFO mlflow.tracking.fluent: Experiment with name 'KNeighborsClassifier_2' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████| 576/576 [1:06:58<00:00,  6.98s/it]

image.png

3.3 Using feature set 3¶

In [23]:
# KNeighborsClassifier

# Parameter ranges
param_ranges = {
    "n_neighbors": np.arange(4, 21, 2),            
    "weights": ["uniform", "distance"],            
    "algorithm": ["auto", "ball_tree", "kd_tree", "brute"],  
    "leaf_size": np.arange(20, 51, 10),            
    "p": [1, 2]                                    
}


# Train and log the model
train_and_log_model(model_class=KNeighborsClassifier, param_ranges=param_ranges, feature_set='3', cv_folds=5)
2024/09/26 17:40:14 INFO mlflow.tracking.fluent: Experiment with name 'KNeighborsClassifier_3' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|███████████████████████████████████████████████████| 576/576 [11:14<00:00,  1.17s/it]

image.png

3.4 Using feature set 4¶

In [24]:
# KNeighborsClassifier

# Parameter ranges
param_ranges = {
    "n_neighbors": np.arange(4, 21, 2),            
    "weights": ["uniform", "distance"],            
    "algorithm": ["auto", "ball_tree", "kd_tree", "brute"],  
    "leaf_size": np.arange(20, 51, 10),            
    "p": [1, 2]                                    
}

# Train and log the model
train_and_log_model(model_class=KNeighborsClassifier, param_ranges=param_ranges, feature_set='4', cv_folds=5)
2024/09/26 17:53:09 INFO mlflow.tracking.fluent: Experiment with name 'KNeighborsClassifier_4' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|███████████████████████████████████████████████████| 576/576 [18:33<00:00,  1.93s/it]

image.png

3.5 Using feature set 5¶

In [25]:
# KNeighborsClassifier

# Parameter ranges
param_ranges = {
    "n_neighbors": np.arange(4, 21, 2),            
    "weights": ["uniform", "distance"],            
    "algorithm": ["auto", "ball_tree", "kd_tree", "brute"],  
    "leaf_size": np.arange(20, 51, 10),            
    "p": [1, 2]                                    
}

# Train and log the model
train_and_log_model(model_class=KNeighborsClassifier, param_ranges=param_ranges, feature_set='5', cv_folds=5)
2024/09/26 18:13:26 INFO mlflow.tracking.fluent: Experiment with name 'KNeighborsClassifier_5' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|███████████████████████████████████████████████████| 576/576 [17:14<00:00,  1.80s/it]

image.png

3.6 Using feature set 6¶

In [26]:
# KNeighborsClassifier

# Parameter ranges
param_ranges = {
    "n_neighbors": np.arange(4, 21, 2),            
    "weights": ["uniform", "distance"],            
    "algorithm": ["auto", "ball_tree", "kd_tree", "brute"],  
    "leaf_size": np.arange(20, 51, 10),            
    "p": [1, 2]                                    
}

# Train and log the model
train_and_log_model(model_class=KNeighborsClassifier, param_ranges=param_ranges, feature_set='6', cv_folds=5)
2024/09/26 18:32:22 INFO mlflow.tracking.fluent: Experiment with name 'KNeighborsClassifier_6' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|███████████████████████████████████████████████████| 576/576 [18:52<00:00,  1.97s/it]

image.png

4. GaussianProcessClassifier¶

4.1 Using feature set 1¶

In [27]:
# Parameter ranges
param_ranges = {
    # "kernel": None,  # Note that the kernel’s hyperparameters are optimized during fitting.
    "optimizer": ["fmin_l_bfgs_b"],  
    "n_restarts_optimizer": [0, 1, 5],  
    "max_iter_predict": [100, 200, 300], 
    "random_state": [42]
}


# Train and log the model
train_and_log_model(model_class=GaussianProcessClassifier, param_ranges=param_ranges, feature_set='1', cv_folds=5)
2024/09/26 18:52:55 INFO mlflow.tracking.fluent: Experiment with name 'GaussianProcessClassifier_1' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|███████████████████████████████████████████████████████| 9/9 [14:53<00:00, 99.33s/it]

image.png

4.2 Using feature set 2¶

In [28]:
# Parameter ranges
param_ranges = {
    # "kernel": None,  # Note that the kernel’s hyperparameters are optimized during fitting.
    "optimizer": ["fmin_l_bfgs_b"],  
    "n_restarts_optimizer": [0, 1, 5],  
    "max_iter_predict": [100, 200, 300], 
    "random_state": [42]
}


# Train and log the model
train_and_log_model(model_class=GaussianProcessClassifier, param_ranges=param_ranges, feature_set='2', cv_folds=5)
2024/09/26 19:10:02 INFO mlflow.tracking.fluent: Experiment with name 'GaussianProcessClassifier_2' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|███████████████████████████████████████████████████████| 9/9 [02:14<00:00, 14.95s/it]

image.png

4.3 Using feature set 3¶

In [29]:
# Parameter ranges
param_ranges = {
    # "kernel": None,  # Note that the kernel’s hyperparameters are optimized during fitting.
    "optimizer": ["fmin_l_bfgs_b"],  
    "n_restarts_optimizer": [0, 1, 5],  
    "max_iter_predict": [100, 200, 300], 
    "random_state": [42]
}


# Train and log the model
train_and_log_model(model_class=GaussianProcessClassifier, param_ranges=param_ranges, feature_set='3', cv_folds=5)
2024/09/26 19:14:00 INFO mlflow.tracking.fluent: Experiment with name 'GaussianProcessClassifier_3' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|███████████████████████████████████████████████████████| 9/9 [00:24<00:00,  2.71s/it]

image.png

4.4 Using feature set 4¶

In [30]:
# Parameter ranges
param_ranges = {
    # "kernel": None,  # Note that the kernel’s hyperparameters are optimized during fitting.
    "optimizer": ["fmin_l_bfgs_b"],  
    "n_restarts_optimizer": [0, 1, 5],  
    "max_iter_predict": [100, 200, 300], 
    "random_state": [42]
}


# Train and log the model
train_and_log_model(model_class=GaussianProcessClassifier, param_ranges=param_ranges, feature_set='4', cv_folds=5)
2024/09/26 19:16:04 INFO mlflow.tracking.fluent: Experiment with name 'GaussianProcessClassifier_4' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|███████████████████████████████████████████████████████| 9/9 [00:36<00:00,  4.03s/it]

image.png

4.5 Using feature set 5¶

In [31]:
# Parameter ranges
param_ranges = {
    # "kernel": None,  # Note that the kernel’s hyperparameters are optimized during fitting.
    "optimizer": ["fmin_l_bfgs_b"],  
    "n_restarts_optimizer": [0, 1, 5],  
    "max_iter_predict": [100, 200, 300], 
    "random_state": [42]
}


# Train and log the model
train_and_log_model(model_class=GaussianProcessClassifier, param_ranges=param_ranges, feature_set='5', cv_folds=5)
2024/09/26 19:18:20 INFO mlflow.tracking.fluent: Experiment with name 'GaussianProcessClassifier_5' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|███████████████████████████████████████████████████████| 9/9 [00:36<00:00,  4.07s/it]

image.png

4.6 Using feature set 6¶

In [32]:
# Parameter ranges
param_ranges = {
    # "kernel": None,  # Note that the kernel’s hyperparameters are optimized during fitting.
    "optimizer": ["fmin_l_bfgs_b"],  
    "n_restarts_optimizer": [0, 1, 5],  
    "max_iter_predict": [100, 200, 300], 
    "random_state": [42]
}


# Train and log the model
train_and_log_model(model_class=GaussianProcessClassifier, param_ranges=param_ranges, feature_set='6', cv_folds=5)
2024/09/26 19:20:38 INFO mlflow.tracking.fluent: Experiment with name 'GaussianProcessClassifier_6' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|███████████████████████████████████████████████████████| 9/9 [00:34<00:00,  3.88s/it]

image.png

5. MLPClassifier¶

5.1 Using feature set 1¶

In [33]:
# Parameter ranges
param_ranges = {
    "hidden_layer_sizes": [(16,32,64,32,16)],  
    "activation": ["logistic", "relu"],          
    "solver": ["adam"],                             
    "learning_rate": ["constant", "adaptive"],        
    "max_iter": [200, 400, 500],                                    
    "tol": [1e-4],                                       
    "early_stopping": [True, False],                                 
    "random_state": [42]                                            
}



# Train and log the model
train_and_log_model(model_class=MLPClassifier, param_ranges=param_ranges, feature_set='1', cv_folds=5)
2024/09/26 19:22:53 INFO mlflow.tracking.fluent: Experiment with name 'MLPClassifier_1' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|██████████████████████████████████████████████████| 24/24 [1:04:22<00:00, 160.94s/it]

image.png

5.2 Using feature set 2¶

In [34]:
# Parameter ranges
param_ranges = {
    "hidden_layer_sizes": [(16,32,64,32,16)],  
    "activation": ["logistic", "relu"],          
    "solver": ["adam"],                             
    "learning_rate": ["constant", "adaptive"],        
    "max_iter": [200, 400, 500],                                    
    "tol": [1e-4],                                       
    "early_stopping": [True, False],                                 
    "random_state": [42]                                            
}



# Train and log the model
train_and_log_model(model_class=MLPClassifier, param_ranges=param_ranges, feature_set='2', cv_folds=5)
2024/09/26 20:29:09 INFO mlflow.tracking.fluent: Experiment with name 'MLPClassifier_2' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 24/24 [11:53<00:00, 29.73s/it]

image.png

5.3 Using feature set 3¶

In [35]:
# Parameter ranges
param_ranges = {
    "hidden_layer_sizes": [(16,32,64,32,16)],  
    "activation": ["logistic", "relu"],          
    "solver": ["adam"],                             
    "learning_rate": ["constant", "adaptive"],        
    "max_iter": [200, 400, 500],                                    
    "tol": [1e-4],                                       
    "early_stopping": [True, False],                                 
    "random_state": [42]                                            
}



# Train and log the model
train_and_log_model(model_class=MLPClassifier, param_ranges=param_ranges, feature_set='3', cv_folds=5)
2024/09/26 20:42:45 INFO mlflow.tracking.fluent: Experiment with name 'MLPClassifier_3' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 24/24 [03:06<00:00,  7.76s/it]

image.png

5.4 Using feature set 4¶

In [36]:
# Parameter ranges
param_ranges = {
    "hidden_layer_sizes": [(16,32,64,32,16)],  
    "activation": ["logistic", "relu"],          
    "solver": ["adam"],                             
    "learning_rate": ["constant", "adaptive"],        
    "max_iter": [200, 400, 500],                                    
    "tol": [1e-4],                                       
    "early_stopping": [True, False],                                 
    "random_state": [42]                                            
}



# Train and log the model
train_and_log_model(model_class=MLPClassifier, param_ranges=param_ranges, feature_set='4', cv_folds=5)
2024/09/26 20:47:35 INFO mlflow.tracking.fluent: Experiment with name 'MLPClassifier_4' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 24/24 [03:36<00:00,  9.03s/it]

image.png

5.5 Using feature set 5¶

In [37]:
# Parameter ranges
param_ranges = {
    "hidden_layer_sizes": [(16,32,64,32,16)],  
    "activation": ["logistic", "relu"],          
    "solver": ["adam"],                             
    "learning_rate": ["constant", "adaptive"],        
    "max_iter": [200, 400, 500],                                    
    "tol": [1e-4],                                       
    "early_stopping": [True, False],                                 
    "random_state": [42]                                            
}



# Train and log the model
train_and_log_model(model_class=MLPClassifier, param_ranges=param_ranges, feature_set='5', cv_folds=5)
2024/09/26 20:52:58 INFO mlflow.tracking.fluent: Experiment with name 'MLPClassifier_5' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 24/24 [03:54<00:00,  9.76s/it]

image.png

5.6 Using feature set 6¶

In [38]:
# Parameter ranges
param_ranges = {
    "hidden_layer_sizes": [(16,32,64,32,16)],  
    "activation": ["logistic", "relu"],          
    "solver": ["adam"],                             
    "learning_rate": ["constant", "adaptive"],        
    "max_iter": [200, 400, 500],                                    
    "tol": [1e-4],                                       
    "early_stopping": [True, False],                                 
    "random_state": [42]                                            
}



# Train and log the model
train_and_log_model(model_class=MLPClassifier, param_ranges=param_ranges, feature_set='6', cv_folds=5)
2024/09/26 20:58:37 INFO mlflow.tracking.fluent: Experiment with name 'MLPClassifier_6' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████████| 24/24 [03:34<00:00,  8.94s/it]

image.png

6. SVC¶

6.1 Using feature set 1¶

In [39]:
# Parameter ranges
param_ranges = {
    'kernel': ['linear','poly', 'rbf', 'sigmoid'],
    'C': [0.1, 1, 5, 10, 20],                  # Regularization parameter. 
    'gamma': ['scale', 'auto', 0.01, 0.1, 1],  # Kernel coefficient for ‘rbf’, ‘poly’ and ‘sigmoid’.
}

# Train and log the model
train_and_log_model(model_class=SVC, param_ranges=param_ranges, feature_set='1', cv_folds=5)
2024/09/26 21:03:57 INFO mlflow.tracking.fluent: Experiment with name 'SVC_1' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|████████████████████████████████████████████████| 100/100 [3:30:31<00:00, 126.31s/it]

image.png

6.2 Using feature set 2¶

In [40]:
# Parameter ranges
param_ranges = {
    'kernel': ['linear','poly', 'rbf', 'sigmoid'],
    'C': [0.1, 1, 5, 10, 20],                  # Regularization parameter. 
    'gamma': ['scale', 'auto', 0.01, 0.1, 1],  # Kernel coefficient for ‘rbf’, ‘poly’ and ‘sigmoid’.
}

# Train and log the model
train_and_log_model(model_class=SVC, param_ranges=param_ranges, feature_set='2', cv_folds=5)
2024/09/27 00:36:15 INFO mlflow.tracking.fluent: Experiment with name 'SVC_2' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|█████████████████████████████████████████████████| 100/100 [1:22:11<00:00, 49.32s/it]

image.png

6.3 Using feature set 3¶

In [41]:
# Parameter ranges
param_ranges = {
    'kernel': ['linear','poly', 'rbf', 'sigmoid'],
    'C': [0.1, 1, 5, 10, 20],                  # Regularization parameter. 
    'gamma': ['scale', 'auto', 0.01, 0.1, 1],  # Kernel coefficient for ‘rbf’, ‘poly’ and ‘sigmoid’.
}

# Train and log the model
train_and_log_model(model_class=SVC, param_ranges=param_ranges, feature_set='3', cv_folds=5)
2024/09/27 02:00:04 INFO mlflow.tracking.fluent: Experiment with name 'SVC_3' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|███████████████████████████████████████████████████| 100/100 [02:24<00:00,  1.44s/it]

image.png

6.4 Using feature set 4¶

In [42]:
# Parameter ranges
param_ranges = {
    'kernel': ['linear','poly', 'rbf', 'sigmoid'],
    'C': [0.1, 1, 5, 10, 20],                  # Regularization parameter. 
    'gamma': ['scale', 'auto', 0.01, 0.1, 1],  # Kernel coefficient for ‘rbf’, ‘poly’ and ‘sigmoid’.
}

# Train and log the model
train_and_log_model(model_class=SVC, param_ranges=param_ranges, feature_set='4', cv_folds=5)
2024/09/27 02:04:10 INFO mlflow.tracking.fluent: Experiment with name 'SVC_4' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|███████████████████████████████████████████████████| 100/100 [03:23<00:00,  2.03s/it]

image.png

6.5 Using feature set 5¶

In [43]:
# Parameter ranges
param_ranges = {
    'kernel': ['linear','poly', 'rbf', 'sigmoid'],
    'C': [0.1, 1, 5, 10, 20],                  # Regularization parameter. 
    'gamma': ['scale', 'auto', 0.01, 0.1, 1],  # Kernel coefficient for ‘rbf’, ‘poly’ and ‘sigmoid’.
}

# Train and log the model
train_and_log_model(model_class=SVC, param_ranges=param_ranges, feature_set='5', cv_folds=5)
2024/09/27 02:09:18 INFO mlflow.tracking.fluent: Experiment with name 'SVC_5' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|███████████████████████████████████████████████████| 100/100 [03:19<00:00,  2.00s/it]

image.png

6.6 Using feature set 6¶

In [44]:
# Parameter ranges
param_ranges = {
    'kernel': ['linear','poly', 'rbf', 'sigmoid'],
    'C': [0.1, 1, 5, 10, 20],                  # Regularization parameter. 
    'gamma': ['scale', 'auto', 0.01, 0.1, 1],  # Kernel coefficient for ‘rbf’, ‘poly’ and ‘sigmoid’.
}

# Train and log the model
train_and_log_model(model_class=SVC, param_ranges=param_ranges, feature_set='6', cv_folds=5)
2024/09/27 02:14:19 INFO mlflow.tracking.fluent: Experiment with name 'SVC_6' does not exist. Creating a new experiment.
Hyperparameter combinations: 100%|███████████████████████████████████████████████████| 100/100 [03:06<00:00,  1.86s/it]

image.png